import java.util.ArrayList;

import optimizer.BasicBlock;
import optimizer.DependencyTable;
import optimizer.Instruction;
import optimizer.Register;


public class testone {

	public static void main(String[] args) {
		System.out.println("Test1 starting...");
		ArrayList<Instruction> instructions = new ArrayList<Instruction>();


//		  2: LW R1, 0[R0]		
//		  6: LW R2, 0[R0]
		
//		  7: LI R3, #2
//		  8: ADD R2, R2, R3
//		  9: SW 0[R0], R2
//		 10: LW R2, 0[R0]
//		 11: LI R3, #1
//		 12: SUB R2, R2, R3
//		 13: SW 0[R0], R2
//		 14: GOTO 2
//		 15: LW R2, 0[R0]
//		 16: OUT
//		 17: HALT
		 
		 
		
		
		// Label, Operation, WrittenTo, ReadFrom1, ReadFrom2, Constant, BranchTarget
//		instructions.add(new Instruction("0", "DATA", null, null, null, -1, null));
//		instructions.add(new Instruction("1", "IN", null, null, null, -1, null));
//		instructions.add(new Instruction("2", "LW", Register.R1, null, null, 15, null));
//		instructions.add(new Instruction("3", "LI", Register.R2, null, null, 10, null));
//		instructions.add(new Instruction("4", "LT", Register.R1, Register.R1, Register.R2, -1, null));
//		instructions.add(new Instruction("5", "BEQZ", Register.R0, null, null, 15, null));		
//		instructions.add(new Instruction("6", "LW", Register.R2, null, null, 15, null));
		 
		 
//		instructions.add(new Instruction(null, "LD", Register.R4, null, null, 15, null));	
//		instructions.add(new Instruction(null, "ADDD", Register.R3, Register.R1, null, 0, null));
//		instructions.add(new Instruction(null, "SUB", Register.R2, Register.R2, null, -1, null));
//		instructions.add(new Instruction(null, "SUB", Register.R3, Register.R2, null, -1, null));
//		instructions.add(new Instruction(null, "ADDD", Register.R2, Register.R3, null, 0, null));
//		instructions.add(new Instruction(null, "BNEZ", null, Register.R3, null, 0, "ELSE"));
//		instructions.add(new Instruction(null, "ADDD", Register.R4, Register.R2, null, 0, null));
//		instructions.add(new Instruction(null, "ADDD", Register.R1, Register.R3, null, 0, null));
		
		BasicBlock block = new BasicBlock(instructions);
		DependencyTable t = DependencyTable.buildDependencyTable(block);
		t.optimize();
		System.out.println("Test1 finished.");
	}
}
